package com.hxk.structuralMode.flyweight;

import java.util.HashMap;
import java.util.Map;

public class ChessFactory {
	
	private static Map<String, IChess> chesss = new HashMap<String, IChess>();
	
	public static IChess getChess(String color) {
		if(chesss.containsKey(color)) {
			return chesss.get(color);
		}else {
			IChess chess = new Chess(color);
			chesss.put(color, chess);
			return chess;
		}
	}

}
